/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
import { HttpSrv } from 'lfun-bg-comp';
import { ImportParams } from '..';

export interface CreateClasses {
  school_id: any;
  grade_id: any;
  grade_no: string;
  class_name: string;
  class_number: string;
  year_established: string;
  teacher_id_card: string;
  teacher_name: string;
  education_stage: string;
  school_system: string;
  monitor: string;
  class_type: string;
  is_bilingual_class: string;
  major_for_vocational: string;
  bilingual_teaching_mode: string;
  ethnic_language: string;
  is_att_class: string;
  att_class_type: string;
}

export interface UpdateClasses {
  id: any;
  school_id: any;
  grade_id: any;
  grade_no: string;
  class_name: string;
  class_number: string;
  year_established: string;
  teacher_id_card: string;
  teacher_name: string;
  education_stage: string;
  school_system: string;
  monitor: string;
  class_type: string;
  is_bilingual_class: string;
  major_for_vocational: string;
  bilingual_teaching_mode: string;
  ethnic_language: string;
  is_att_class: string;
  att_class_type: string;
}

export interface SearchClass {
  school_id: string;
  grade_name?: string;
}

// 删除
export const deleteClasses = (class_id: any) => HttpSrv().delete(`/school/v1/classes/?class_id=${class_id}`);
// 查询单个
export const getGlasses = (grade_id: any) => HttpSrv().get(`/school/v1/classes/`, { params: { grade_id } });
// 新增
export const createClasses = (grades: CreateClasses) => HttpSrv().post(`/school/v1/classes/`, grades);
// 分页 /api/school/v1/grades/page
export const searchClasses = (params: SearchClass, page: number, per_page: number) =>
  HttpSrv().get('/school/v1/classes/page', { params: { ...params, page, per_page } });
// 修改
export const updateClasses = (grades: UpdateClasses) => HttpSrv().put('/school/v1/classes/', grades);
// 班级列表
export const listClasses = (school_id, grade_id?) =>
  HttpSrv().get(`/school/v1/classes/page`, { params: { school_id, grade_id, page: 1, per_page: 3000 } });

export const importClass = (params: ImportParams) => HttpSrv().post(`/school/v1/classes/classes-import`, { params });
